import { registerComponents } from '@basic'
import RangeInput from '@basic/RangeInput'
import ObjectInput from '@basic/ObjectInput'
import AreaSelect from '@basic/area/AreaCascader'
import DateSelect from '@basic/date/DatePicker'
import DateRangeSelect from '@basic/date/DateRangePicker'
import DictionarySelect from '@basic/DictionarySelect.vue'
import VehicleModelSelect from "@basic/VehicleModelSelect.vue"
import DriverLicenseTypeSelect from "@basic/DriverLicenseTypeSelect.vue"
import CustomerSelect from "@basic/CustomerSelect.vue"
import ConsigneeSelect from "@basic/ConsigneeSelect.vue"
import CarrierSelect from "@basic/CarrierSelect.vue"
import AvatarUpload from "@basic/AvatarUpload.vue"
import GenderSelect from "@basic/GenderSelect.vue"
import ReceivingAddress from "@basic/ReceivingAddress.vue"
import ShippingAddress from "@basic/ShippingAddress.vue"
import RelationalOperatorsSelect from "@basic/RelationalOperatorsSelect.vue"
import InputMultiple from '@basic/InputMultiple'
import BooleanSelect from "@basic/BooleanSelect"


export {
  ValidatorOptions,
  ResourceScopeOptions,
  DictionarySelect,
  ObjectInput,
  RangeInput,
  DateRangeSelect,
  DateSelect,
  AreaSelect,
  ReceivingAddress,
  ShippingAddress,
  AvatarUpload,
  GenderSelect,
  CarrierSelect,
  CustomerSelect,
  ConsigneeSelect,
  DriverLicenseTypeSelect,
  VehicleModelSelect,
  RelationalOperatorsSelect,
  InputMultiple,
  BooleanSelect
}


export default {
  install (Vue) {
    const modulesFiles = require.context('.', true, /\.vue$/)
    registerComponents(Vue, modulesFiles)
    Vue.component(DateSelect.name, DateSelect)
    Vue.component(DateRangeSelect.name, DateRangeSelect)
    Vue.component(DictionarySelect.name, DictionarySelect)
    Vue.component(AreaSelect.name, AreaSelect)
    Vue.component(CarrierSelect.name, CarrierSelect);
    Vue.component(ConsigneeSelect.name, ConsigneeSelect);
    Vue.component(CustomerSelect.name, CustomerSelect);
    Vue.component(AvatarUpload.name, AvatarUpload);
    Vue.component(GenderSelect.name, GenderSelect);
    Vue.component(DriverLicenseTypeSelect.name, DriverLicenseTypeSelect);
    Vue.component(VehicleModelSelect.name, VehicleModelSelect);
    Vue.component(RangeInput.name, RangeInput)
    Vue.component(ObjectInput.name, ObjectInput)
    Vue.component(ReceivingAddress.name, ReceivingAddress)
    Vue.component(ShippingAddress.name, ShippingAddress)
    Vue.component(InputMultiple.name, InputMultiple)
    Vue.component(BooleanSelect.name, BooleanSelect)
  }
};

class ValidatorOptions extends Array {
  constructor() {
    super();
    this.add("string");
    this.add("number");
    this.add("boolean");
    this.add("method");
    this.add("regexp");
    this.add("integer");
    this.add("float");
    this.add("array");
    this.add("object");
    this.add("enum");
    this.add("date");
    this.add("url");
    this.add("hex");
    this.add("email");
    this.add("any");
  }
  add (name) {
    this.push({ label: name, value: name });
  }
}

class ResourceScopeOptions extends Array {
  constructor() {
    super();
    this.add("submit");
  }
  add (scope) {
    this.push({ label: scope, value: scope });
  }
}

